//
//@File    :	4.2_string.cpp
//@Time    :	2021/08/03 10:40:04
//@Auther  :	Sun Sheng
//@Contact :	970340843@qq.com
//@Desc    :	storing strings in an array
//

#include <cstring>
#include <iostream>

int main()
{
    using namespace std;
    const int Size = 15;
    char name1[Size];
    char name2[Size] = "C++owboy";

    cout<<"Howdy!I'm "<<name2;
    cout<<"! What's your name?\n";
    cin>>name1;
    cout<<"Well, "<<name1<<",your name has ";
    cout<<strlen(name1)<<" letters and is stored\n";
    cout<<"in an array of "<<sizeof(name1)<<" bytes.\n";
    cout<<"Your initial is "<<name1[0]<<".\n";
    
    name2[3] = '\0';
    
    cout<<"Here are the first 3characters of my name: ";
    cout<<name2<<endl;

    system("pause");
    return 0;
}